package org.suk.dp.interpreter;

/**
 * Description: 表达式类<br/>
 * @version V1.0  2017/6/22 16:04  by 石冬冬(dongdong.shi@ucarinc.com) - Heil Hitler
 */
public abstract class Expression {
    //解释器
    public void interpret(PlayContext context){
        if(context.getText().length() == 0){
            return;
        }
        String playKey = context.getText().substring(0,1);
        context.setText(context.getText().substring(2));
        double playValue = Double.valueOf(context.getText().substring(0,context.getText().indexOf(" ")));
        context.setText(context.getText().substring(context.getText().indexOf(" ") + 1));
        execute(playKey,playValue);
    }
    //执行
    public abstract void execute(String key,double value);
}
